 function nrn_kifvh()
 % fit a neuron output file of fsl vs kifvh
 % read all the files first.
hf = findobj('Tag', 'f0');
if(isempty(hf))
	hf = figure('Tag', 'f0');
	clf;
end
	
for i=1:7
 	fn = sprintf('../nrn/pok/fit%04d.dat', i-1);
	fh = fopen(fn, 'r');
	l = fgetl(fh);
	a = sscanf(l, '%d %f');
	npts = a(1); kvh = a(2);
	r = fscanf(fh, '%f %f', [2,Inf])
	[fp, chisq, niter, fit, err, dep] = mrqfit('sum_boltzmann', [0 10 -1 -80 ], r(1,:), r(2,:), [], [1 1 1 1], [], [], 250);
	vh(i)=fp(4);
	vx(i)=kvh;	
	hold on
	plot(r(1,:), r(2,:), 'bx', r(1,:), fit, 'r-')
end
print -dill -loose 'fitx.ai';
hfig = findobj('Tag', 'f1');
if(isempty(hfig))
	hfig = figure('Tag', 'f1');
	clf;
end;
x0=-110:-60;
plot(vx, vh, 'ro', x0, x0, 'k-');

return


